package org.groupg.practice.guiPractice.progressDemo;


import javax.swing.*;

/**
 * 1. 创建一个JProgressBar实例，并设置其属性。
 */
public class ProgressBarDemo {
    private JProgressBar progressBar;

    public ProgressBarDemo() {
        JFrame frame = new JFrame("进度条示例");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 200);

        progressBar = new JProgressBar(0, 100);
        progressBar.setValue(0);
        progressBar.setStringPainted(true);

        frame.add(progressBar);
        frame.setVisible(true);
    }

    public void updateProgress(int progress) {
        progressBar.setValue(progress);
    }

    public static void main(String[] args) {
        new ProgressBarDemo();
    }
}